fix(lightsail): Handle wildcard DNS entries with escaped asterisks #44588
+16
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #44587
Description
AWS Lightsail API returns wildcard domain entries with asterisks escaped as
\052(octal notation). This causes Terraform to fail reading wildcard DNSentries after creation and to detect drift on subsequent applies.
This PR fixes the issue by normalizing wildcard characters in two places:
*and\052formats when searching for domain entries\052back to*before saving to stateChanges
internal/service/lightsail/domain_entry.go:FindDomainEntryById()to match entries using both wildcard formatsflattenDomainEntryName()to unescape\052to*for state consistencyTesting
Tested with:
Test scenario:
*.subdomain.example.com)terraform applyagain to verify no drift is detected*instead of\052Before this fix:
Error: reading AWS Lightsail DomainEntry (*.test,example.com,A,1.2.3.4): empty result
After this fix:
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
Related Issues
aws_lightsail_domain_entryid field update separator to,to support_intxtrecords #27791Checklist
Notes
This fix maintains backward compatibility with existing non-wildcard DNS entries while properly handling the escaped wildcard format returned by the AWS
Lightsail API.